﻿using System;
using System.Globalization;
using System.Net.NetworkInformation;
using System.Security.Cryptography;
using System.Text;
#if UNITY_IOS
using System.Runtime.InteropServices;
#endif
using UnityEngine;

namespace CGF
{
    public class SystemHelper
    {
        public enum InternetStatus
        {
            NoNet,
            Wifi,
            Mobile
        }
        public enum InternetQuality
        {
            Low,
            Middle,
            Hight
        }

        private static AndroidJavaClass jc;
        private static string deviceId;


        /// <summary>
        /// Android SDK版本（如29，30）
        /// </summary>
        public static int GetAndroidSDKVersion()
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            jc ??= new AndroidJavaClass("cn.helper.SystemHelper");
            return jc.CallStatic<int>("getBatteryPercent");
#else
            return 0;
#endif
        }

        /// <summary>
        /// 获取当前电量的百分比（0-100的整数）
        /// </summary>
        public static int GetBatteryPercent()
        {
#if UNITY_EDITOR
            return 100;
#elif UNITY_ANDROID
            jc ??= new AndroidJavaClass("cn.helper.SystemHelper");
            return jc.CallStatic<int>("getBatteryPercent");
#elif UNITY_IOS
            return (int)(_GetBatteryProgress() * 100);
#else
            return 0;
#endif
        }

        /// <summary>
        /// 获取当前网络类型
        /// </summary>
        public static InternetStatus GetInternetType()
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            jc ??= new AndroidJavaClass("cn.helper.SystemHelper");
            string statusStr = jc.CallStatic<string>("getInternetType");
            switch (statusStr)
            {
                case "Wifi":
                    return InternetStatus.Wifi;
                case "Mobile":
                    return InternetStatus.Mobile;
                case "NoNet":
                    return InternetStatus.NoNet;
            }
            return InternetStatus.NoNet;
#elif UNITY_IOS && !UNITY_EDITOR
            string statusStr = _GetInternetStatus();
            switch (statusStr)
            {
                case "Wifi":
                    return InternetStatus.Wifi;
                case "CellularNetwork":
                    return InternetStatus.Mobile;
                case "NoNet":
                    return InternetStatus.NoNet;
            }
            return InternetStatus.NoNet;
#else
            return InternetStatus.Wifi;
#endif
        }

        /// <summary>
        /// 获取是否是Android模拟器
        /// </summary>
        public static bool IsAndroidSimulator()
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            jc ??= new AndroidJavaClass("cn.helper.SystemHelper");
            return jc.CallStatic<bool>("isSimulator");
#else
            return false;
#endif
        }

        /// <summary>
        /// 获取是否是平板设备
        /// </summary>
        public static bool IsPad()
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            float physicscreen = Mathf.Sqrt(Screen.width * Screen.width + Screen.height * Screen.height) / Screen.dpi;
            return physicscreen >= 7f;
#elif UNITY_IOS && !UNITY_EDITOR
            string genneration = SystemInfo.deviceModel.ToString();
            return genneration.ToLower().Substring(0, 3) == "ipad";
#else
            return false;
#endif
        }

        /// <summary>
        /// 获取系统时区ID（如：微软时区数据库返回"China Standard Time"，IANA/奥尔森时区数据库返回"Asia/Shanghai"，必要时需做两种适配）
        /// </summary>
        public static string GetSysTimeZoneID()
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            jc ??= new AndroidJavaClass("cn.helper.SystemHelper");
            return jc.CallStatic<string>("getSysTimeZoneID");
#elif UNITY_IOS && !UNITY_EDITOR
            return "Asia/Shanghai";
#else
            return TimeZoneInfo.Local.Id;
#endif
        }

        /// <summary>
        /// 获取系统时区Name（如：GMT+08:00）
        /// </summary>
        public static string GetSysTimeZoneName()
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            jc ??= new AndroidJavaClass("cn.helper.SystemHelper");
            return jc.CallStatic<string>("getSysTimeZoneName");
#elif UNITY_IOS && !UNITY_EDITOR
            return "GMT+08:00";
#else
            if (TimeZoneInfo.Local.BaseUtcOffset.Hours < 0)
            {
                string h = TimeZoneInfo.Local.BaseUtcOffset.Hours.ToString("d2");
                string m = (-TimeZoneInfo.Local.BaseUtcOffset.Minutes).ToString("d2");
                return $"GMT{h}:{m}";
            }
            else
            {
                string h = TimeZoneInfo.Local.BaseUtcOffset.Hours.ToString("d2");
                string m = TimeZoneInfo.Local.BaseUtcOffset.Minutes.ToString("d2");
                return $"GMT+{h}:{m}";
            }
#endif
        }

        /// <summary>
        /// 获取设备ID(仅在Unity主线程可取)
        /// </summary>
        public static string GetDeviceID(bool upperCase = true)
        {
            if (!string.IsNullOrEmpty(deviceId)) return deviceId;
#if UNITY_ANDROID && !UNITY_EDITOR
            jc ??= new AndroidJavaClass("cn.helper.SystemHelper");
            deviceId = MD5(jc.CallStatic<string>("getDeviceID"), upperCase);
            return deviceId;
#elif UNITY_IOS && !UNITY_EDITOR
            string iosPackName = AppHelper.GetAppPackageName();
            deviceId = MD5(_GetDeviceId(iosPackName), upperCase);
            return deviceId;
#else
            NetworkInterface[] nice = NetworkInterface.GetAllNetworkInterfaces();
            foreach (NetworkInterface adaper in nice)
            {
                deviceId = adaper.GetPhysicalAddress().ToString();
                if (!string.IsNullOrEmpty(deviceId))
                {
                    deviceId = MD5(deviceId, upperCase);
                    return deviceId;
                }
            }
            return null;
#endif
        }

        /// <summary>
        /// 根据包名获取已安装App的签名信息（返回json:{"MD5":"XXXXX","SHA1":"XXXXXX","SHA256":"XXXXXXX"}）
        /// </summary>
        public static string GetAppSignInfoByPackName(string packName)
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            jc ??= new AndroidJavaClass("cn.helper.SystemHelper");
            return jc.CallStatic<string>("getAppSignInfoByPackName", packName);
#else

            return null;
#endif
        }

        /// <summary>
        /// 安装Apk
        /// </summary>
        public static void InstallApk(string apkPath)
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            jc ??= new AndroidJavaClass("cn.helper.SystemHelper");
            jc.CallStatic("installApk", apkPath);
#endif
        }

        private static string MD5(string inputStr, bool upperCase)
        {
            byte[] inputBytes = Encoding.UTF8.GetBytes(inputStr);
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] hash = md5.ComputeHash(inputBytes);
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < hash.Length; i++)
            {
                if (upperCase)
                {
                    sb.Append(hash[i].ToString("X2"));//字母大写
                }
                else
                {
                    sb.Append(hash[i].ToString("x2"));//字母小写
                }
            }
            return sb.ToString();
        }

        /// <summary>
        /// 判断系统语言是否印度常用语言
        /// </summary>
        public static bool IsIndiaLanguage()
        {
            string currSysLanguage = CultureInfo.CurrentCulture.ToString().ToLower();
            switch (currSysLanguage)
            {
                case "hi":
                case "hi-in":
                case "ta":
                case "ta-in":
                case "te":
                case "te-in":
                    return true;
                default:
                    return false;
            }
        }

        /// <summary>
        /// 打印当前系统语言的语种
        /// </summary>
        public static void LogSysLanguage()
        {
            string TAG = "[系统语言]";
            //不能用Application.systemLanguage
            string lowerStr = CultureInfo.CurrentCulture.ToString().ToLower();
            switch (lowerStr)
            {
                case "zh":
                case "zh-cn":
                case "zh-sg":
                    Debug.Log($"{TAG} [{lowerStr}] 中文(简体)");
                    break;
                case "zh-tw":
                case "zh-hk":
                case "zh-mo":
                case "zh-hant":
                    Debug.Log($"{TAG} [{lowerStr}] 中文(繁体)");
                    break;
                case "ko":
                case "ko-kr":
                    Debug.Log($"{TAG} [{lowerStr}] 朝鲜语");
                    break;
                case "ja":
                case "ja-jp":
                    Debug.Log($"{TAG} [{lowerStr}] 日本语");
                    break;
                case "en":
                case "en-gb":
                case "en-au":
                case "en-ca":
                case "en-nz":
                case "en-bz":
                case "en-cb":
                case "en-ie":
                case "en-jm":
                case "en-ph":
                case "en-tt":
                case "en-za":
                case "en-zw":
                case "en-us":
                case "en-029":
                case "en-my":
                case "en-sg":
                case "en-in":
                    Debug.Log($"{TAG} [{lowerStr}] 英语(美国)");
                    break;
                case "af":
                case "af-za":
                    Debug.Log($"{TAG} [{lowerStr}] 南非荷兰语");
                    break;
                case "yo":
                case "yo-ng":
                    Debug.Log($"{TAG} [{lowerStr}] 约鲁巴语");
                    break;
                case "tg":
                case "tg-cyrl":
                case "tg-cyrl-tj":
                    Debug.Log($"{TAG} [{lowerStr}] 塔吉克语");
                    break;
                case "tzm":
                case "tzm-latn":
                case "tzm-latn-dz":
                    Debug.Log($"{TAG} [{lowerStr}] 塔马塞特语");
                    break;
                case "sma":
                case "sma-no":
                case "sma-se":
                    Debug.Log($"{TAG} [{lowerStr}] 南萨米语");
                    break;
                case "as":
                case "as-in":
                    Debug.Log($"{TAG} [{lowerStr}] 阿萨姆语");
                    break;
                case "ne":
                case "ne-np":
                    Debug.Log($"{TAG} [{lowerStr}] 尼泊尔语");
                    break;
                case "am":
                case "am-et":
                    Debug.Log($"{TAG} [{lowerStr}] 阿姆哈拉语");
                    break;
                case "ar":
                case "ar-dz":
                case "ar-ae":
                case "ar-bh":
                case "ar-eg":
                case "ar-iq":
                case "ar-jo":
                case "ar-kw":
                case "ar-lb":
                case "ar-ly":
                case "ar-ma":
                case "ar-om":
                case "ar-qa":
                case "ar-sa":
                case "ar-sy":
                case "ar-tn":
                case "ar-ye":
                    Debug.Log($"{TAG} [{lowerStr}] 阿拉伯语");
                    break;
                case "az":
                case "az-latn":
                case "az-latn-az":
                case "az-cyrl":
                case "az-cyrl-az":
                case "az-az":
                    Debug.Log($"{TAG} [{lowerStr}] 阿塞拜疆语");
                    break;
                case "be":
                case "be-by":
                    Debug.Log($"{TAG} [{lowerStr}] 比利时语/白俄罗斯语");
                    break;
                case "lb":
                case "lb-lu":
                    Debug.Log($"{TAG} [{lowerStr}] 卢森堡语");
                    break;
                case "ga":
                case "ga-ie":
                    Debug.Log($"{TAG} [{lowerStr}] 爱尔兰语");
                    break;
                case "kn":
                case "kn-in":
                    Debug.Log($"{TAG} [{lowerStr}] 埃纳德语/卡纳拉语");
                    break;
                case "rw":
                case "rw-rw":
                    Debug.Log($"{TAG} [{lowerStr}] 卢旺达语");
                    break;
                case "bg":
                case "bg-bg":
                    Debug.Log($"{TAG} [{lowerStr}] 保加利亚语");
                    break;
                case "bs":
                case "bs-latn":
                case "bs-cyrl":
                case "bs-ba":
                    Debug.Log($"{TAG} [{lowerStr}] 波斯尼亚语");
                    break;
                case "ca":
                case "ca-es":
                    Debug.Log($"{TAG} [{lowerStr}] 加泰隆语");
                    break;
                case "cs":
                case "cs-cz":
                    Debug.Log($"{TAG} [{lowerStr}] 捷克语");
                    break;
                case "cy":
                case "cy-gb":
                    Debug.Log($"{TAG} [{lowerStr}] 威尔士语");
                    break;
                case "da":
                case "da-dk":
                    Debug.Log($"{TAG} [{lowerStr}] 丹麦语");
                    break;
                case "de":
                case "de-at":
                case "de-ch":
                case "de-de":
                case "de-li":
                case "de-lu":
                    Debug.Log($"{TAG} [{lowerStr}] 德语");
                    break;
                case "dv":
                case "dv-mv":
                    Debug.Log($"{TAG} [{lowerStr}] 第维埃语/迪维希语");
                    break;
                case "el":
                case "el-gr":
                    Debug.Log($"{TAG} [{lowerStr}] 希腊语");
                    break;
                case "co":
                case "co-fr":
                    Debug.Log($"{TAG} [{lowerStr}] 科西嘉语");
                    break;
                case "dsb":
                case "dsb-de":
                    Debug.Log($"{TAG} [{lowerStr}] 下索布语");
                    break;
                case "eo":
                    Debug.Log($"{TAG} [{lowerStr}] 世界语");
                    break;
                case "es":
                case "es-ar":
                case "es-bo":
                case "es-cl":
                case "es-co":
                case "es-cr":
                case "es-do":
                case "es-ec":
                case "es-es":
                case "es-gt":
                case "es-hn":
                case "es-mx":
                case "es-ni":
                case "es-pa":
                case "es-pe":
                case "es-pr":
                case "es-py":
                case "es-sv":
                case "es-uy":
                case "es-ve":
                    Debug.Log($"{TAG} [{lowerStr}] 西班牙语");
                    break;
                case "et":
                case "et-ee":
                    Debug.Log($"{TAG} [{lowerStr}] 爱沙尼亚语");
                    break;
                case "prs":
                case "prs-af":
                    Debug.Log($"{TAG} [{lowerStr}] 达里语");
                    break;
                case "eu":
                case "eu-es":
                    Debug.Log($"{TAG} [{lowerStr}] 巴士克语/巴斯克语");
                    break;
                case "oc":
                case "oc-fr":
                    Debug.Log($"{TAG} [{lowerStr}] 奥克西唐语");
                    break;
                case "ba":
                case "ba-ru":
                    Debug.Log($"{TAG} [{lowerStr}] 巴什基尔语");
                    break;
                case "or":
                case "or-in":
                    Debug.Log($"{TAG} [{lowerStr}] 奥里雅语");
                    break;
                case "nso":
                case "nso-za":
                    Debug.Log($"{TAG} [{lowerStr}] 巴索托语");
                    break;
                case "fa":
                case "fa-ir":
                    Debug.Log($"{TAG} [{lowerStr}] 波斯语");
                    break;
                case "iu":
                case "iu-latn":
                case "iu-latn-ca":
                case "iu-cans":
                case "iu-cans-ca":
                    Debug.Log($"{TAG} [{lowerStr}] 因纽特语");
                    break;
                case "fi":
                case "fi-fi":
                    Debug.Log($"{TAG} [{lowerStr}] 芬兰语");
                    break;
                case "kl":
                case "kl-gl":
                    Debug.Log($"{TAG} [{lowerStr}] 格陵兰语");
                    break;
                case "km":
                case "km-kh":
                    Debug.Log($"{TAG} [{lowerStr}] 高棉语");
                    break;
                case "fy":
                case "fy-nl":
                    Debug.Log($"{TAG} [{lowerStr}] 弗里西亚语");
                    break;
                case "fil":
                case "fil-ph":
                    Debug.Log($"{TAG} [{lowerStr}] 菲律宾语");
                    break;
                case "fo":
                case "fo-fo":
                    Debug.Log($"{TAG} [{lowerStr}] 法罗语");
                    break;
                case "fr":
                case "fr-be":
                case "fr-ca":
                case "fr-ch":
                case "fr-fr":
                case "fr-lu":
                case "fr-mc":
                    Debug.Log($"{TAG} [{lowerStr}] 法语");
                    break;
                case "gl":
                case "gl-es":
                    Debug.Log($"{TAG} [{lowerStr}] 加里西亚语");
                    break;
                case "gu":
                case "gi-in":
                    Debug.Log($"{TAG} [{lowerStr}] 古吉拉特语");
                    break;
                case "he":
                case "he-il":
                    Debug.Log($"{TAG} [{lowerStr}] 希伯来语");
                    break;
                case "hi":
                case "hi-in":
                    Debug.Log($"{TAG} [{lowerStr}] 印地语（印度使用）");
                    break;
                case "hr":
                case "hr-ba":
                case "hr-hr":
                    Debug.Log($"{TAG} [{lowerStr}] 克罗地亚语");
                    break;
                case "hu":
                case "hu-hu":
                    Debug.Log($"{TAG} [{lowerStr}] 匈牙利语");
                    break;
                case "hy":
                case "hy-am":
                    Debug.Log($"{TAG} [{lowerStr}] 亚美尼亚语");
                    break;
                case "id":
                case "id-id":
                    Debug.Log($"{TAG} [{lowerStr}] 印度尼西亚语");
                    break;
                case "is":
                case "is-is":
                    Debug.Log($"{TAG} [{lowerStr}] 冰岛语");
                    break;
                case "ig":
                case "ig-ng":
                    Debug.Log($"{TAG} [{lowerStr}] 伊博语");
                    break;
                case "smn":
                case "smn-fi":
                    Debug.Log($"{TAG} [{lowerStr}] 伊纳里萨米语");
                    break;
                case "ii":
                case "ii-cn":
                    Debug.Log($"{TAG} [{lowerStr}] 彝语");
                    break;
                case "it":
                case "it-ch":
                case "it-it":
                    Debug.Log($"{TAG} [{lowerStr}] 意大利语");
                    break;
                case "ka":
                case "ka-ge":
                    Debug.Log($"{TAG} [{lowerStr}] 格鲁吉亚语");
                    break;
                case "kk":
                case "kk-kz":
                    Debug.Log($"{TAG} [{lowerStr}] 哈萨克语");
                    break;
                case "ha":
                case "ha-latn":
                case "ha-latn-ng":
                    Debug.Log($"{TAG} [{lowerStr}] 豪撒语");
                    break;
                case "kok":
                case "kok-in":
                    Debug.Log($"{TAG} [{lowerStr}] 孔卡尼语");
                    break;
                case "ky":
                case "ky-kg":
                    Debug.Log($"{TAG} [{lowerStr}] 吉尔吉斯语");
                    break;
                case "lo":
                case "lo-la":
                    Debug.Log($"{TAG} [{lowerStr}] 老挝语");
                    break;
                case "lt":
                case "lt-lt":
                    Debug.Log($"{TAG} [{lowerStr}] 立陶宛语");
                    break;
                case "lv":
                case "lv-lv":
                    Debug.Log($"{TAG} [{lowerStr}] 拉脱维亚语");
                    break;
                case "mi":
                case "mi-nz":
                    Debug.Log($"{TAG} [{lowerStr}] 毛利语");
                    break;
                case "mk":
                case "mk-mk":
                    Debug.Log($"{TAG} [{lowerStr}] 马其顿语");
                    break;
                case "mn":
                case "mn-mong":
                case "mn-mong-cn":
                case "mn-cyrl":
                case "mn-mn":
                    Debug.Log($"{TAG} [{lowerStr}] 蒙古语");
                    break;
                case "mr":
                case "mr-in":
                    Debug.Log($"{TAG} [{lowerStr}] 马拉地语");
                    break;
                case "moh":
                case "moh-ca":
                    Debug.Log($"{TAG} [{lowerStr}] 莫霍克语");
                    break;
                case "bn":
                case "bn-bd":
                case "bn-in":
                    Debug.Log($"{TAG} [{lowerStr}] 孟加拉语");
                    break;
                case "ms":
                case "ms-bn":
                case "ms-my":
                    Debug.Log($"{TAG} [{lowerStr}] 马来语");
                    break;
                case "ug":
                case "ug-cn":
                    Debug.Log($"{TAG} [{lowerStr}] 维吾尔语");
                    break;
                case "wo":
                case "wo-sn":
                    Debug.Log($"{TAG} [{lowerStr}] 沃洛夫语");
                    break;
                case "mt":
                case "mt-mt":
                    Debug.Log($"{TAG} [{lowerStr}] 马耳他语");
                    break;
                case "arn":
                case "arn-cl":
                    Debug.Log($"{TAG} [{lowerStr}] 马普丹冈语");
                    break;
                case "ml":
                case "ml-in":
                    Debug.Log($"{TAG} [{lowerStr}] 马拉雅拉姆语");
                    break;
                case "nb":
                case "nb-no":
                    Debug.Log($"{TAG} [{lowerStr}] 书面挪威语");
                    break;
                case "no":
                case "nn":
                case "nn-no":
                    Debug.Log($"{TAG} [{lowerStr}] 挪威语");
                    break;
                case "nl":
                case "nl-be":
                case "nl-nl":
                    Debug.Log($"{TAG} [{lowerStr}] 荷兰语");
                    break;
                case "ns":
                case "ns-za":
                    Debug.Log($"{TAG} [{lowerStr}] 北梭托语");
                    break;
                case "sms":
                case "sms-fi":
                    Debug.Log($"{TAG} [{lowerStr}] 斯科特萨米语");
                    break;
                case "pa":
                case "pa-in":
                    Debug.Log($"{TAG} [{lowerStr}] 旁遮普语");
                    break;
                case "pl":
                case "pl-pl":
                    Debug.Log($"{TAG} [{lowerStr}] 波兰语");
                    break;
                case "br":
                case "br-fr":
                    Debug.Log($"{TAG} [{lowerStr}] 布里多尼语");
                    break;
                case "bo":
                case "bo-cn":
                    Debug.Log($"{TAG} [{lowerStr}] 藏语");
                    break;
                case "qut":
                case "qut-gt":
                    Debug.Log($"{TAG} [{lowerStr}] 基切语");
                    break;
                case "ps":
                case "ps-af":
                    Debug.Log($"{TAG} [{lowerStr}] 普什图语");
                    break;
                case "pt":
                case "pt-br":
                case "pt-pt":
                    Debug.Log($"{TAG} [{lowerStr}] 葡萄牙语（巴西使用）");
                    break;
                case "quz":
                case "quz-bo":
                case "quz-ec":
                case "quz-pe":
                    Debug.Log($"{TAG} [{lowerStr}] 克丘亚语");
                    break;
                case "qu":
                case "qu-bo":
                case "qu-ec":
                case "qu-pe":
                    Debug.Log($"{TAG} [{lowerStr}] 克丘亚语");
                    break;
                case "ro":
                case "ro-ro":
                    Debug.Log($"{TAG} [{lowerStr}] 罗马尼亚语");
                    break;
                case "rm":
                case "rm-ch":
                    Debug.Log($"{TAG} [{lowerStr}] 罗曼什语");
                    break;
                case "smj":
                case "smj-no":
                case "smj-se":
                    Debug.Log($"{TAG} [{lowerStr}] 律勒萨米语");
                    break;
                case "ru":
                case "ru-ru":
                    Debug.Log($"{TAG} [{lowerStr}] 俄语");
                    break;
                case "sa":
                case "sa-in":
                    Debug.Log($"{TAG} [{lowerStr}] 梵文");
                    break;
                case "se":
                case "se-no":
                case "se-se":
                case "se-fi":
                    Debug.Log($"{TAG} [{lowerStr}] 萨摩斯语/北萨米语");
                    break;
                case "sk":
                case "sk-sk":
                    Debug.Log($"{TAG} [{lowerStr}] 斯洛伐克语");
                    break;
                case "sl":
                case "sl-si":
                    Debug.Log($"{TAG} [{lowerStr}] 斯洛文尼亚语");
                    break;
                case "si":
                case "si-lk":
                    Debug.Log($"{TAG} [{lowerStr}] 僧伽罗语");
                    break;
                case "hsb":
                case "hsb-de":
                    Debug.Log($"{TAG} [{lowerStr}] 上索布语");
                    break;
                case "sq":
                case "sq-al":
                case "gsw":
                case "gsw-fr":
                    Debug.Log($"{TAG} [{lowerStr}] 阿尔巴尼亚语");
                    break;
                case "sr":
                case "sr-latn":
                case "sr-latn-me":
                case "sr-latn-rs":
                case "sr-cyrl":
                case "sr-cyrl-me":
                case "sr-ba":
                    Debug.Log($"{TAG} [{lowerStr}] 塞尔维亚");
                    break;
                case "sv":
                case "sv-fi":
                case "sv-se":
                    Debug.Log($"{TAG} [{lowerStr}] 瑞典语");
                    break;
                case "sw":
                case "sw-ke":
                    Debug.Log($"{TAG} [{lowerStr}] 斯瓦希里语");
                    break;
                case "gd":
                case "gd-gb":
                    Debug.Log($"{TAG} [{lowerStr}] 苏格兰盖立语");
                    break;
                case "sah":
                case "sah-ru":
                    Debug.Log($"{TAG} [{lowerStr}] 雅库特语");
                    break;
                case "syr":
                case "syr-sy":
                    Debug.Log($"{TAG} [{lowerStr}] 叙利亚语");
                    break;
                case "ta":
                case "ta-in":
                    Debug.Log($"{TAG} [{lowerStr}] 泰米尔语（印度有某些地区也在使用）");
                    break;
                case "te":
                case "te-in":
                    Debug.Log($"{TAG} [{lowerStr}] 泰卢固语（印度有某些地区也在使用）");
                    break;
                case "th":
                case "th-th":
                    Debug.Log($"{TAG} [{lowerStr}] 泰语");
                    break;
                case "tl":
                case "tl-ph":
                    Debug.Log($"{TAG} [{lowerStr}] 塔加路语");
                    break;
                case "tn":
                case "tn-za":
                    Debug.Log($"{TAG} [{lowerStr}] 茨瓦纳语");
                    break;
                case "tr":
                case "tr-tr":
                    Debug.Log($"{TAG} [{lowerStr}] 土耳其语");
                    break;
                case "ts":
                    Debug.Log($"{TAG} [{lowerStr}] 宗加语");
                    break;
                case "tt":
                case "tt-ru":
                    Debug.Log($"{TAG} [{lowerStr}] 鞑靼语");
                    break;
                case "uk":
                case "uk-ua":
                    Debug.Log($"{TAG} [{lowerStr}] 乌克兰语");
                    break;
                case "ur":
                case "ur-pk":
                    Debug.Log($"{TAG} [{lowerStr}] 乌都语/乌尔都语");
                    break;
                case "uz":
                case "uz-uz":
                case "uz-latn":
                case "uz-latn-uz":
                case "uz-cyrl":
                case "uz-cyrl-uz":
                    Debug.Log($"{TAG} [{lowerStr}] 乌兹别克语");
                    break;
                case "vi":
                case "vi-vn":
                    Debug.Log($"{TAG} [{lowerStr}] 越南语");
                    break;
                case "xh":
                case "xh-za":
                    Debug.Log($"{TAG} [{lowerStr}] 班图语/索萨语");
                    break;
                case "zu":
                case "zu-za":
                    Debug.Log($"{TAG} [{lowerStr}] 祖鲁语");
                    break;
                default:
                    Debug.Log($"{TAG} [{lowerStr}] 未知语言:" + lowerStr);
                    break;
            }
        }

#if UNITY_IOS
        [DllImport("__Internal")]
        static extern float _GetBatteryProgress();
        [DllImport("__Internal")]
        static extern string _GetInternetStatus();
        [DllImport("__Internal")]
        static extern string _GetDeviceId(string iosPackgeName);
#endif

    }
}